package com.wenqiner.requesttool.domain;

/**
 * @author rhf
 * @date 2023-05-09
 **/
public class HttpConstant {
    /**
     * 连接超时时间
     */
    public static Integer CONNECTION_TIMEOUT = 200 * 1000;
    public static Integer READ_TIMEOUT = 200 * 1000;
    public static String DEFAULT_CHARSET = "UTF-8";
    public static final String CONTENT_TYPE = "application/json";
    public static final String CERT_FORMAT = "PKCS12";
    public static final String TLS = "TLS";
    /**
     * HTTP keep-alive behavior can be controlled by the http.
     * keepAlive (default: true) and http. maxConnections (default: 5) system properties.
     * For more information, see Networking Properties
     */
    public static String DEFAULT_MAX_CONNECTIONS = "100";
    /**
     *The maximum number of HTTP requests which can be pipelined until the connection is closed by the server.
     * Setting this attribute to 1 will disable HTTP/1.0 keep-alive, as well as HTTP/1.1 keep-alive and pipelining.
     * Setting this to -1 will allow an unlimited amount of pipelined or keep-alive HTTP requests.
     * If not specified, this attribute is set to 100.
     */
    public static String MAX_KEEPALIVE_REQUESTS = "-1";
    /**
     * 长连接
     */
    public static Boolean KEEPALIVE = true;


    public static Integer getConnectionTimeout() {
        return CONNECTION_TIMEOUT;
    }

    public static void setConnectionTimeout(Integer connectionTimeout) {
        CONNECTION_TIMEOUT = connectionTimeout;
    }

    public static Integer getReadTimeout() {
        return READ_TIMEOUT;
    }

    public static void setReadTimeout(Integer readTimeout) {
        READ_TIMEOUT = readTimeout;
    }

    public static String getDefaultCharset() {
        return DEFAULT_CHARSET;
    }

    public static void setDefaultCharset(String defaultCharset) {
        DEFAULT_CHARSET = defaultCharset;
    }

    public static String getDefaultMaxConnections() {
        return DEFAULT_MAX_CONNECTIONS;
    }

    public static void setDefaultMaxConnections(String defaultMaxConnections) {
        DEFAULT_MAX_CONNECTIONS = defaultMaxConnections;
    }

    public static String getMaxKeepaliveRequests() {
        return MAX_KEEPALIVE_REQUESTS;
    }

    public static void setMaxKeepaliveRequests(String maxKeepaliveRequests) {
        MAX_KEEPALIVE_REQUESTS = maxKeepaliveRequests;
    }

    public static Boolean getKeepAlive() {
        return KEEPALIVE;
    }

    public static void setKeepAlive(Boolean keepAlive) {
        HttpConstant.KEEPALIVE = keepAlive;
    }
}
